package com.shiwaixiangcun.customer.adapter;

import android.support.annotation.Nullable;
import android.widget.ImageView;

import com.bumptech.glide.Glide;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.shiwaixiangcun.customer.R;
import com.shiwaixiangcun.customer.entity.SurroundMerchantTypeBean;
import com.shiwaixiangcun.customer.glide.ImageDisplayUtil;

import java.util.List;


/**
 *
 * @author Administrator
 * @date 2016/7/13
 */
public class MerchTypeAdapter extends BaseQuickAdapter<SurroundMerchantTypeBean.DataBean, BaseViewHolder> {


    public MerchTypeAdapter(@Nullable List<SurroundMerchantTypeBean.DataBean> data) {
        super(R.layout.item_home_surround_image, data);
    }


    @Override
    protected void convert(BaseViewHolder helper, SurroundMerchantTypeBean.DataBean item) {
        helper.setText(R.id.tv_name_merch_type, item.getName());
        ImageView imageView = helper.getView(R.id.iv_certificates);
        if (item.getName().equals("找装修")) {
            Glide.with(mContext).load(R.drawable.decorate).into(imageView);
        } else {
            ImageDisplayUtil.showImageView(mContext, item.getImage().getAccessUrl(), imageView);
        }
    }

}
